<style>
    .form-copy {
        margin-right: 5px;
        border-radius: 0;
        box-shadow: none;
        padding: 4px 12px 7px 12px;
        font-size: 14px;
        line-height: 1.42857143;
        color: #555;
        border: 1px solid #ccc;
        transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
    }
    .select2 {
        margin-right: 5px
    }
</style>
{{-- 行选操作 start --}}
<div class="btn-group">
    <a class="btn btn-sm btn-default">  {{ trans('admin.action') }}</a>
    <button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown">
        <span class="caret"></span>
        <span class="sr-only">Toggle Dropdown</span>
    </button>
    <ul class="dropdown-menu" role="menu">
        <li><a href="#" class="grid-batch-status" data-action="disableItem">停用 </a></li>
        <li><a href="#" class="grid-batch-status" data-action="enableItem">启用 </a></li>
    </ul>
</div>
{{-- 行选操作 end --}}
<div class="btn-group">
    <form class="form-horizontal" action="{{ $action }}" pjax-container method="get">
        <input type="text" class="form-copy" style=" width:150px;" name="order_no" value="{{ $filtersBlade['order_no'] }}" placeholder="订单号">

        <select id="kol_id" name="kol_id">
            {{ $filtersBlade['kol_id'] }}
        </select>
        <select id="link_type" name="link_type">
            {{ $filtersBlade['link_type'] }}
        </select>
        <select id="status" name="status">
            {{ $filtersBlade['status'] }}
        </select>
        <button class="btn btn-sm btn-info submit"><i class="fa fa-search"></i>&nbsp;&nbsp;{{ trans('admin.search') }}</button>
        <a style="margin-left: 10px;" href="{{ $action }}" class="btn btn-sm btn-default"><i class="fa fa-undo"></i>&nbsp;&nbsp;{{ trans('admin.reset') }}</a>
    </form>
</div>
<script language="JavaScript" type="text/javascript">
    $(function () {
        $('#kol_id').select2({placeholder: 'kol红人', allowClear: true, width: '120px'});
        $('#link_type').select2({placeholder: '链接类型', allowClear: true, width: '120px'});
        $('#status').select2({placeholder: '状态', allowClear: true, width: '120px'});

        $('.grid-batch-status').on('click', function() {
            let idArr = $.admin.grid.selected();
            if(idArr.length == 0){
                swal('请选择单据', '', 'error');
                return false;
            }
            let action = $(this).data('action');
            $.ajax({
                method: 'post',
                url: '/xqc/kol-manage/kol-video-ajax',
                data: {
                    _token: "{{ csrf_token() }}",
                    param:idArr,
                    action:action
                },
                success: function (data) {
                    if (typeof data === 'object') {
                        if (data.status) {
                            $.pjax.reload('#pjax-container');
                            toastr.success(data.message);
                        } else {
                            swal(data.message, '', 'error');
                        }
                    }
                }
            });
        });
    });
</script>
